$OpenBSD: patch-cmd_web_go,v 1.1 2017/04/05 00:57:47 danj Exp $

Backported from upstream https://github.com/go-gitea/gitea/pull/1368

--- cmd/web.go.orig	Thu Mar  9 22:25:12 2017
+++ cmd/web.go	Tue Mar 21 22:27:47 2017
@@ -677,7 +677,12 @@ func runWeb(ctx *cli.Context) error {
 	case setting.HTTPS:
 		err = runHTTPS(listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
 	case setting.FCGI:
-		err = fcgi.Serve(nil, context2.ClearHandler(m))
+		listener, err := net.Listen("tcp", listenAddr)
+		if err != nil {
+			log.Fatal(4, "Failed to bind to %s", listenAddr, err)
+		}
+		defer listener.Close()
+		err = fcgi.Serve(listener, context2.ClearHandler(m))
 	case setting.UnixSocket:
 		if err := os.Remove(listenAddr); err != nil && !os.IsNotExist(err) {
 			log.Fatal(4, "Failed to remove unix socket directory %s: %v", listenAddr, err)
